//
// Created by liushuai on 2020/2/11.
//

#include "firstUniqChar.h"
#include <map>
char firstUniqChar(string s){
    map <char,int> freq;
    char result = ' ';
    for(auto c:s){
        if(!freq.count(c))
            freq[c] = 1;
        else
            freq[c] += 1;
    }
    for(auto e:s){
        if(freq[e] == 1){
            result = e;
            break;
        }
    }
    return result;

}
